<template>
	<view class="container">

		<!--扇形图 -->
		<view class="charts-box">
			<text>一周收支概况</text>
			<qiun-data-charts type="ring" :opts="opts" :chartData="chartData" />
		</view>

		<!--词云 -->
		<view class="charts-box">
			<text class="box-text">本周用户搜索趋势</text>
			<qiun-data-charts type="word" :opts="opts2" :chartData="chartData2" />
		</view>

		<!-- 分类管理 -->
		<view class="cate-section">

			<navigator url="/pages/index/addvip/addvip" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/添加会员.png"></image>
					<text>添加会员</text>
				</view>
			</navigator>

			<navigator url="/pages/index/vipmanagement/vipmanagement" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/会员管理.png"></image>
					<text>会员管理</text>
				</view>
			</navigator>

			<navigator url="/pages/index/goodsmanage/goodsmanage" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/商城管理.png"></image>
					<text>商品管理</text>
				</view>
			</navigator>

			<navigator url="/pages/index/salemanage/salemanage" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/营销管理.png"></image>
					<text>营销管理</text>
				</view>
			</navigator>

			<navigator url="/pages/index/paymanage/paymanage" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/支出管理.png"></image>
					<text>支出管理</text>
				</view>
			</navigator>

			<navigator url="/pages/index/accountmanage/home/index" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/账户管理.png"></image>
					<text>账户管理</text>
				</view>
			</navigator>

			<navigator url="/pages/index/shopmanage/shopmanage" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/营业设置.png"></image>
					<text>商铺设置</text>
				</view>
			</navigator>
			
			<navigator url="/pages/index/dailymanage/dailymanage" hover-class="navigator-hover">
				<view class="cate-item">
					<image src="/static/daily.png"></image>
					<text>日志管理</text>
				</view>
			</navigator>
			
		</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				chartData: {},
				chartData2: {},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['ring'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts: {
					rotate: false,
					rotateLock: false,
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [5, 5, 5, 5],
					dataLabel: true,
					legend: {
						show: true,
						position: "right",
						lineHeight: 25
					},
					title: {
						name: "收支",
						fontSize: 10,
						color: "#666666"
					},
					subtitle: {
						name: "",
						fontSize: 15,
						color: "#7cb5ec"
					},
					extra: {
						ring: {
							ringWidth: 60,
							activeOpacity: 0.5,
							activeRadius: 10,
							offsetAngle: 0,
							labelWidth: 15,
							border: true,
							borderWidth: 3,
							borderColor: "#FFFFFF",
							linearType: "custom"
						}
					}
				},

				opts2: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: undefined,
					extra: {
						word: {
							type: "normal",
							autoColors: false
						}
					}
				}
			}
		},
		onReady() {

			this.getServerData();

			this.getServerData2()
		},
		onLoad() {
			this.loadData();
		},
		methods: {
			getServerData() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						series: [{
							data: [{
								"name": "收入",
								"value": 60
							}, {
								"name": "支出",
								"value": 30
							}]
						}]
					};
					this.chartData = JSON.parse(JSON.stringify(res));
				}, 500);
			},

			getServerData2() {
				//模拟从服务器获取数据时的延时
				setTimeout(() => {
					//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
					let res = {
						series: [{
								name: "手机",
								textSize: 25,
								data: undefined
							},
							{
								name: "电脑",
								textSize: 20,
								data: undefined
							},
							{
								name: "笔记本",
								textSize: 20,
								data: undefined
							},
							{
								name: "化妆品",
								textSize: 20,
								data: undefined
							},
							{
								name: "薯片",
								textSize: 20,
								data: undefined
							},
							{
								name: "进口食品",
								textSize: 20,
								data: undefined
							},
							{
								name: "零食",
								textSize: 20,
								data: undefined
							},
							{
								name: "低价捡漏",
								textSize: 20,
								data: undefined
							},
							{
								name: "T恤",
								textSize: 10,
								data: undefined
							},
							{
								name: "显卡",
								textSize: 12,
								data: undefined
							},
							{
								name: "cpu",
								textSize: 8,
								data: undefined
							},
							{
								name: "内存",
								textSize: 8,
								data: undefined
							},
							{
								name: "健身",
								textSize: 10,
								data: undefined
							},
							{
								name: "低糖",
								textSize: 12,
								data: undefined
							},
							{
								name: "六级",
								textSize: 10,
								data: undefined
							},
							{
								name: "四级",
								textSize: 12,
								data: undefined
							}
						]
					};
					this.chartData2 = JSON.parse(JSON.stringify(res));
				}, 500);
			},
		},
	}
</script>

<style lang="scss">
	/* #ifdef MP */
	page {
		.cate-section {
			position: relative;
			z-index: 5;
			border-radius: 16upx 16upx 0 0;
			margin-top: -20upx;
		}

		.carousel-section {
			padding: 0;

			.titleNview-placing {
				padding-top: 0;
				height: 0;
			}

			.carousel {
				.carousel-item {
					padding: 0;
				}
			}

			.swiper-dots {
				left: 45upx;
				bottom: 40upx;
			}
		}
	}

	/* #endif */


	page {
		background: #f5f5f5;
	}




	/* 分类 */
	.cate-section {
		display: flex;
		justify-content: space-around;
		align-items: center;
		flex-wrap: wrap;
		padding: 30upx 22upx;
		background: #fff;

		.cate-item {
			display:flex;
			width: 80px;
			flex-direction: column;
			align-items: center;
			font-size: $font-sm + 2upx;
			color: $font-color-dark;
		}

		/* 原图标颜色太深,不想改图了,所以加了透明度 */
		image {
			width: 88upx;
			height: 88upx;
			margin-bottom: 14upx;
			border-radius: 50%;
			opacity: .7;
			box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
		}
	}

	/* 请根据实际需求修改父元素尺寸，组件自动识别宽高 */
	.charts-box {
		width: 100%;
		height: 300px;
		//background-color: #fff;
		
		
	}
	
</style>
